﻿'    Open Subtitle Editor
'    Copyright (c) 2009-2010 Discovery OSS Team
'
'    This file is part of Open Subtitle Editor.
'
'    Open Subtitle Editor is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    Open Subtitle Editor is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with Open Subtitle Editor.  If not, see <http://www.gnu.org/licenses/>.

Public NotInheritable Class frmAbout

    Private ApplicationTitle As String

    Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Set the title of the form.

        If My.Application.Info.Title <> "" Then
            ApplicationTitle = My.Application.Info.Title
        Else
            ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If

    End Sub

    ''' <summary>
    ''' Tries and loads all translation strings from the current language file.
    ''' </summary>
    ''' <remarks>If a certain line is missing, the program resets to English and prints the missing
    ''' line in the Debug window, as well as shows a message telling the user to look for an updated
    ''' version of the language file.</remarks>
    Public Sub LoadLangStrings()
        Me.Text = String.Format(loadStringFromLangFile("aboutWord") & " {0}", ApplicationTitle)
        ' Initialize all of the text displayed on the About Box.
        ' TODO: Customize the application's assembly information in the "Application" pane of the project 
        '    properties dialog (under the "Project" menu).
        Me.LabelProductName.Text = My.Application.Info.ProductName
        Me.LabelVersion.Text = loadStringFromLangFile("versionWord") & " " & VersionNumberInterpretation()
        Me.LabelCopyright.Text = My.Application.Info.Copyright
        Me.LabelCompanyName.Text = My.Application.Info.CompanyName
        Me.TextBoxDescription.Text = My.Application.Info.Description & newLine & newLine & _
                                     loadStringFromLangFile("licensedString")
        btnLicense.Text = loadStringFromLangFile("licenseWord")
    End Sub

    Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
        Me.Close()
    End Sub

    Private Sub btnLicense_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLicense.Click
        frmLicense.ShowDialog()
    End Sub
End Class
